<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #cvs {
            border: 3px solid pink;
        }
    </style>
</head>

<body>
    <canvas id="cvs" width="600" height="400"></canvas>
</body>
<script>
    //获取canvas元素
    const cvsDom = document.querySelector('#cvs')

    //生成canvas绘制元素
    const context = cvsDom.getContext('2d')
    // context.fillRect('black')


    //开始绘制路径
    context.beginPath();
    //绘制圆
    context.arc(150, 150, 100, Math.PI / 180 * 0, Math.PI / 180 * 360, false);
    context.fillStyle = 'green';
    context.fill();
    context.stroke();


    context.beginPath();

    context.arc(100, 100, 10, Math.PI / 180 * 0, Math.PI / 180 * 360, false);
    context.fillStyle = '#f00';
    context.fill();
    context.stroke();

    context.beginPath();
    context.arc(200, 100, 20, Math.PI / 180 * 0, Math.PI / 180 * 360, false);
    context.fillStyle = 'pink';
    context.fill();
    context.stroke();

    context.beginPath();
    context.arc(150, 190, 20, Math.PI / 180 * 0, Math.PI / 180 * 180, true);
    context.strokeStyle = '#f00';
    context.stroke();

    context.font = '30px sans-serif';
    context.fillText('封校', 10, 50);
    context.stroke()

    context.moveTo(400, 60);
    context.lineTo(400, 220);
    context.stroke();

    context.moveTo(400, 220);
    context.lineTo(600, 220);
    context.stroke();

    context.moveTo(420, 200);
    context.lineTo(450, 150);
    context.lineTo(450, 200);
    context.lineTo(500, 200);
    context.lineTo(450, 60);
    context.lineTo(470, 200);
    context.stroke();
</script>

</html>